%endmarker `None` ("end marker")

%layout Indent ("indent")
%layout Unindent ("unindent")
%layout NewLine ("new line")

%define pg.autotoken False
%define pg.indented False

%token Name
%token Number
%token Test
%token '%%'
%token '+', '-', '*', '/', '%', '(', ')'
%token ','

Expression:
    Binary (left : Expression, right : Expression)
    Unary (operand : Expression)

%%

lower = ['a'-'z']
upper = ['A'-'Z']
digit = ['0'-'9']
name = (lower | upper | '_') (lower | upper | '_' | digit)*
number = digit+

^ '%%' $ => '%%'
'+' => '+'
'-' => '-'
'*' => '*'
'/' => '/'
'%' => '%'
'(' => '('
')' => ')'
('a' | 'b')* 'abb' => Test
name => Name
number => Number
